package com.auction.controller.admin;

import com.auction.dto.OrderPageQueryDTO;
import com.auction.pojo.PageResult;
import com.auction.pojo.Result;
import com.auction.service.OrderService;
import com.auction.vo.OrderVO;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * 管理端订单控制器
 */
@Slf4j
@RestController("adminOrderController")
@RequestMapping("/admin/order")
public class OrderController {

    @Autowired
    private OrderService orderService;

    /**
     * 获取订单详情
     * 
     * @param id 订单ID
     * @return 订单详情
     */
    @GetMapping("/{id}")
    public Result<OrderVO> getById(@PathVariable Long id) {
        log.info("管理员获取订单详情：id={}", id);
        OrderVO orderVO = orderService.getById(id);
        return Result.success(orderVO);
    }

    /**
     * 分页查询订单列表
     * @param orderPageQueryDTO
     * @return
     */
    @GetMapping("/page")
    public Result<PageResult> page(OrderPageQueryDTO orderPageQueryDTO) {
        log.info("管理员分页查询订单列表：{}", orderPageQueryDTO);
        PageResult pageResult = orderService.page(orderPageQueryDTO);
        return Result.success(pageResult);
    }
}